package pers.mine.vo;

/**
 * @author Mine
 * @since 2016年10月20日_下午5:43:06
 */
public class BaseExample {
	protected Integer beginIndex;
	protected Integer pageSize;
	protected Integer nowPage;

	public BaseExample() {
	}

	/**
	 * @param beginIndex
	 * @param pageSize
	 */
	public void initLimit(Integer nowPage, Integer pageSize) {
		// 简单校验
		nowPage = ((nowPage == null || nowPage < 1) ? 1 : nowPage);
		pageSize = ((pageSize == null || pageSize < 1) ? 5 : pageSize);
		this.nowPage = nowPage;
		this.beginIndex = (nowPage - 1) * pageSize;
		this.pageSize = pageSize;
	}

	public Integer getBeginIndex() {
		return beginIndex;
	}

	public void setBeginIndex(Integer beginIndex) {
		this.beginIndex = beginIndex;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getNowPage() {
		return nowPage;
	}

	public void setNowPage(Integer nowPage) {
		this.nowPage = nowPage;
	}

	public String showBase() {
		return "BaseExample [beginIndex=" + beginIndex + ", pageSize="
				+ pageSize + ", nowPage=" + nowPage + "]";
	}

}
